<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>悬浮效果</title>
    <style>
      .box-container {
        color: #fff;
        border: 2px solid #0000ffe3;
        cursor: pointer;
        position: absolute;
        border-radius: 5px;
        padding: 5px;
        background: #555;
        width: 150px;
      }
      .box-container::after {
        top: 51px;
        position: absolute;
        left: 65px;
        content: "";
        border-width: 13px;
        border-style: solid;
        border-color: #555 transparent transparent transparent;
      }
      .circle {
        margin-right: 4px;
        border-radius: 50%;
        margin-top: 0px;
        width: 15px;
        background: antiquewhite;
        height: 15px;
        display: inline-block;
      }
      body {
        background-color: burlywood;
        height: 600px;
      }
    </style>
  </head>
  <body>
    <div class="box-container" id="box">
      <div class="title">贷款</div>
      <span class="circle"></span>
      <span class="context">666.66</span>
    </div>
    <script>
      let body = document.getElementsByTagName("body")[0];
      let box = document.getElementById("box");
      body.addEventListener("mousemove", function (event) {
        box.style.left = event.clientX - 75 + "px";
        box.style.top = event.clientY + "px";
      });
    </script>
  </body>
</html>
